package com.ruoyi.common.utils;


import com.ruoyi.common.config.RuoYiConfig;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;

/**
 * 流程图片操作
 */
public class ProcessPictureUtils {

    public static void main(String[] args) {
        String rootPath = "D:\\cloud-platform-root\\uploadPath\\chart/";
        String jxImg = System.currentTimeMillis() + "-水泵工况图.png";
        //svg转png
        ProcessPictureUtils.convertToPng("<svg data-v-16b9fa44=\"\" id=\"chartSvg\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" baseProfile=\"full\" width=\"752\" height=\"573\" viewBox=\"0 0 752 573\" class=\"chart-shb\" style=\"user-select: none;\"><g><g id=\"axis\"><path id=\"yAxisYch\" d=\"M100.5 48 L100.5 249\" fill=\"none\" stroke=\"#060c75\" stroke-width=\"1\" stroke-linecap=\"round \" transform=\"translate(0,0)\"></path><path id=\"yAxisZhgl\" d=\"M100.5 289 L100.5 488\" fill=\"none\" stroke=\"#035e07\" stroke-width=\"1\" stroke-linecap=\"round \" transform=\"translate(0,0)\"></path><path id=\"xAxisDh\" d=\"M601.5 47.5 L601.5 248.5\" fill=\"none\" stroke=\"#6b0277\" stroke-width=\"1\" stroke-linecap=\"round \" transform=\"translate(0,0)\"></path><path id=\"xAxisShbxl\" d=\"M601.5 289.5 L601.5 488.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-width=\"1\" stroke-linecap=\"round \" transform=\"translate(0,0)\"></path><path id=\"xAxis\" d=\"M100.5 488.5 L601.5 488.5\" fill=\"none\" stroke=\"#000000\" stroke-width=\"1\" stroke-linecap=\"round\"></path></g><g><path d=\"M100.5 488.5 L100.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M110.5 488.5 L110.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M120.5 488.5 L120.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M130.5 488.5 L130.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M140.5 488.5 L140.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M150.5 488.5 L150.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M160.5 488.5 L160.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M170.5 488.5 L170.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M180.5 488.5 L180.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M190.5 488.5 L190.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M200.5 488.5 L200.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M210.5 488.5 L210.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M220.5 488.5 L220.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M230.5 488.5 L230.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M240.5 488.5 L240.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M250.5 488.5 L250.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M260.5 488.5 L260.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M270.5 488.5 L270.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M280.5 488.5 L280.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M290.5 488.5 L290.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M300.5 488.5 L300.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M310.5 488.5 L310.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M320.5 488.5 L320.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M330.5 488.5 L330.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M340.5 488.5 L340.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M350.5 488.5 L350.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M360.5 488.5 L360.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M370.5 488.5 L370.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M380.5 488.5 L380.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M390.5 488.5 L390.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M400.5 488.5 L400.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M410.5 488.5 L410.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M420.5 488.5 L420.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M430.5 488.5 L430.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M440.5 488.5 L440.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M450.5 488.5 L450.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M460.5 488.5 L460.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M470.5 488.5 L470.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M480.5 488.5 L480.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M490.5 488.5 L490.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M500.5 488.5 L500.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M510.5 488.5 L510.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M520.5 488.5 L520.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M530.5 488.5 L530.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M540.5 488.5 L540.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M550.5 488.5 L550.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M560.5 488.5 L560.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M570.5 488.5 L570.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M580.5 488.5 L580.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M590.5 488.5 L590.5 490.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><path d=\"M600.5 488.5 L600.5 493.5\" fill=\"none\" stroke=\"#030303\" stroke-width=\"1\" transform=\"translate(0.5,0.5)\" stroke-linecap=\"round\"></path><g><path d=\"M95 248.5 L100 248.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 240.5 L100 240.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 232.5 L100 232.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 224.5 L100 224.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 216.5 L100 216.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M95 208.5 L100 208.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 200.5 L100 200.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 192.5 L100 192.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 184.5 L100 184.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 176.5 L100 176.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M95 168.5 L100 168.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 160.5 L100 160.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 152.5 L100 152.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 144.5 L100 144.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 136.5 L100 136.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M95 128.5 L100 128.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 120.5 L100 120.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 112.5 L100 112.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 104.5 L100 104.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 96.5 L100 96.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M95 88.5 L100 88.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 80.5 L100 80.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 72.5 L100 72.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 64.5 L100 64.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M98 56.5 L100 56.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path><path d=\"M95 48.5 L100 48.5\" fill=\"none\" stroke=\"#060c75\" stroke-linecap=\"round\"></path></g><g><path d=\"M95 488.5 L100 488.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 480.5 L100 480.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 472.5 L100 472.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 464.5 L100 464.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 456.5 L100 456.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M95 448.5 L100 448.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 440.5 L100 440.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 432.5 L100 432.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 424.5 L100 424.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 416.5 L100 416.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M95 408.5 L100 408.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 400.5 L100 400.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 392.5 L100 392.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 384.5 L100 384.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 376.5 L100 376.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M95 368.5 L100 368.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 360.5 L100 360.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 352.5 L100 352.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 344.5 L100 344.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 336.5 L100 336.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M95 328.5 L100 328.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 320.5 L100 320.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 312.5 L100 312.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 304.5 L100 304.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M98 296.5 L100 296.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path><path d=\"M95 288.5 L100 288.5\" fill=\"none\" stroke=\"#035e07\" stroke-linecap=\"round\"></path></g><g><path d=\"M602 248.5 L607 248.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 240.5 L604 240.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 232.5 L604 232.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 224.5 L604 224.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 216.5 L604 216.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 208.5 L607 208.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 200.5 L604 200.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 192.5 L604 192.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 184.5 L604 184.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 176.5 L604 176.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 168.5 L607 168.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 160.5 L604 160.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 152.5 L604 152.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 144.5 L604 144.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 136.5 L604 136.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 128.5 L607 128.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 120.5 L604 120.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 112.5 L604 112.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 104.5 L604 104.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 96.5 L604 96.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 88.5 L607 88.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 80.5 L604 80.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 72.5 L604 72.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 64.5 L604 64.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 56.5 L604 56.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path><path d=\"M602 48.5 L607 48.5\" fill=\"none\" stroke=\"#6b0277\" stroke-linecap=\"round\"></path></g><g><path d=\"M602 488.5 L607 488.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 480.5 L604 480.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 472.5 L604 472.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 464.5 L604 464.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 456.5 L604 456.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 448.5 L607 448.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 440.5 L604 440.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 432.5 L604 432.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 424.5 L604 424.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 416.5 L604 416.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 408.5 L607 408.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 400.5 L604 400.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 392.5 L604 392.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 384.5 L604 384.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 376.5 L604 376.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 368.5 L607 368.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 360.5 L604 360.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 352.5 L604 352.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 344.5 L604 344.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 336.5 L604 336.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 328.5 L607 328.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 320.5 L604 320.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 312.5 L604 312.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 304.5 L604 304.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 296.5 L604 296.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path><path d=\"M602 288.5 L607 288.5\" fill=\"none\" stroke=\"#5e0f03\" stroke-linecap=\"round\"></path></g></g><g id=\"axis_name\"><text dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#060c75\" class=\"axis-name\" style=\"font-size: 14px; font-family: &quot;Microsoft YaHei&quot;;\"><tspan fill=\"#060c75\" dx=\"45.5\" dy=\"118\">扬</tspan><tspan fill=\"#060c75\" dx=\"-14\" dy=\"15\">程</tspan></text><text dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#6b0277\" class=\"axis-name\" style=\"font-size: 14px; font-family: &quot;Microsoft YaHei&quot;;\"><tspan fill=\"#6b0277\" dx=\"666.5\" dy=\"118\">单</tspan><tspan fill=\"#6b0277\" dx=\"-14\" dy=\"15\">耗</tspan></text><text dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#035e07\" class=\"axis-name\" style=\"font-size: 14px; font-family: &quot;Microsoft YaHei&quot;;\"><tspan fill=\"#035e07\" dx=\"35.5\" dy=\"359\">轴</tspan><tspan fill=\"#035e07\" dx=\"-14\" dy=\"15\">功</tspan><tspan fill=\"#035e07\" dx=\"-14\" dy=\"15\">率</tspan></text><text dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#5e0f03\" class=\"axis-name\" style=\"font-size: 14px; font-family: &quot;Microsoft YaHei&quot;;\"><tspan fill=\"#5e0f03\" dx=\"656.5\" dy=\"359\">水</tspan><tspan fill=\"#5e0f03\" dx=\"-14\" dy=\"15\">泵</tspan><tspan fill=\"#5e0f03\" dx=\"-14\" dy=\"15\">效</tspan><tspan fill=\"#5e0f03\" dx=\"-14\" dy=\"15\">率</tspan></text><text transform=\"translate(351 528.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" class=\"axis-name\" style=\"font-size: 14px; font-family: &quot;Microsoft YaHei&quot;;\">瞬时流量[m³/h]</text></g><g id=\"axis_tick\"><text transform=\"translate(100.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">5.8</text><text transform=\"translate(150.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">7.5</text><text transform=\"translate(200.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">9.2</text><text transform=\"translate(250.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">10.9</text><text transform=\"translate(300.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">12.6</text><text transform=\"translate(350.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">14.3</text><text transform=\"translate(400.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">16.0</text><text transform=\"translate(450.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">17.7</text><text transform=\"translate(500.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">19.4</text><text transform=\"translate(550.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">21.1</text><text transform=\"translate(600.5 503.5)\" dominant-baseline=\"central\" text-anchor=\"middle\" fill=\"#030303\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">22.8</text><text transform=\"translate(90.5 248)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#060c75\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">0.0</text><text transform=\"translate(90.5 208)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#060c75\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">273.0</text><text transform=\"translate(90.5 168)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#060c75\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">546.0</text><text transform=\"translate(90.5 128)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#060c75\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">819.0</text><text transform=\"translate(90.5 88)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#060c75\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">1092.0</text><text transform=\"translate(90.5 48)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#060c75\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">1365.0</text><text transform=\"translate(90.5 488)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#035e07\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">0.0</text><text transform=\"translate(90.5 448)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#035e07\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">0.2</text><text transform=\"translate(90.5 408)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#035e07\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">0.4</text><text transform=\"translate(90.5 368)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#035e07\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">0.6</text><text transform=\"translate(90.5 328)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#035e07\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">0.8</text><text transform=\"translate(90.5 288)\" dominant-baseline=\"central\" text-anchor=\"end\" fill=\"#035e07\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">1.0</text><text transform=\"translate(611.5 248)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#6b0277\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">0.0</text><text transform=\"translate(611.5 208)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#6b0277\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">9.2</text><text transform=\"translate(611.5 168)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#6b0277\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">18.4</text><text transform=\"translate(611.5 128)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#6b0277\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">27.6</text><text transform=\"translate(611.5 88)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#6b0277\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">36.8</text><text transform=\"translate(611.5 48)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#6b0277\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">46.0</text><text transform=\"translate(611.5 488)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#5e0f03\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">0.0</text><text transform=\"translate(611.5 448)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#5e0f03\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">7450.5</text><text transform=\"translate(611.5 408)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#5e0f03\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">14901.0</text><text transform=\"translate(611.5 368)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#5e0f03\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">22351.5</text><text transform=\"translate(611.5 328)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#5e0f03\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">29802.0</text><text transform=\"translate(611.5 288)\" dominant-baseline=\"central\" text-anchor=\"start\" fill=\"#5e0f03\" style=\"font-size: 12px; font-family: &quot;Microsoft YaHei&quot;;\">37252.5</text></g><path fill=\"none\" stroke=\"#060c75\" stroke-width=\"1\" stroke-linejoin=\"bevel\" d=\"M119.29411764705883 197.3996336996337 C119.29411764705883 197.3996336996337 285.16991176470583 205.60733626373627 293.11764705882354 203.4186813186813 C443.052294117647 139.18682197802198 514 88.70512820512823 514 88.70512820512823\"></path><path fill=\"none\" stroke=\"#035e07\" stroke-width=\"1\" stroke-linejoin=\"bevel\" d=\"M119.29411764705883 488.5 C119.29411764705883 488.5 223.58823529411765 488.5 293.11764705882354 488.5 C381.47058823529414 488.5 514 488.5 514 488.5\"></path><path fill=\"none\" stroke=\"#6b0277\" stroke-width=\"1\" stroke-linejoin=\"bevel\" d=\"M119.29411764705883 88.67391304347831 C119.29411764705883 88.67391304347831 217.70622058823528 135.2684086956522 293.11764705882354 165.80434782608697 C375.58858823529414 215.73797217391305 514 248.5 514 248.5\"></path><path fill=\"none\" stroke=\"#5e0f03\" stroke-width=\"1\" stroke-linejoin=\"bevel\" d=\"M119.29411764705883 328.5107375343937 C119.29411764705883 328.5107375343937 137.92698823529412 422.86801288504125 293.11764705882354 485.7726662640091 C295.8093529411765 487.4091836521039 514 488.5 514 488.5\"></path><circle cx=\"119.29411764705883\" cy=\"197.3996336996337\" r=\"1\" stroke=\"#060c75\" stroke-width=\"1\" fill=\"#060c75\"></circle><circle cx=\"293.11764705882354\" cy=\"203.4186813186813\" r=\"1\" stroke=\"#060c75\" stroke-width=\"1\" fill=\"#060c75\"></circle><circle cx=\"514\" cy=\"88.70512820512823\" r=\"1\" stroke=\"#060c75\" stroke-width=\"1\" fill=\"#060c75\"></circle><circle cx=\"119.29411764705883\" cy=\"488.5\" r=\"1\" stroke=\"#035e07\" stroke-width=\"1\" fill=\"#035e07\"></circle><circle cx=\"293.11764705882354\" cy=\"488.5\" r=\"1\" stroke=\"#035e07\" stroke-width=\"1\" fill=\"#035e07\"></circle><circle cx=\"514\" cy=\"488.5\" r=\"1\" stroke=\"#035e07\" stroke-width=\"1\" fill=\"#035e07\"></circle><circle cx=\"119.29411764705883\" cy=\"88.67391304347831\" r=\"1\" stroke=\"#6b0277\" stroke-width=\"1\" fill=\"#6b0277\"></circle><circle cx=\"293.11764705882354\" cy=\"165.80434782608697\" r=\"1\" stroke=\"#6b0277\" stroke-width=\"1\" fill=\"#6b0277\"></circle><circle cx=\"514\" cy=\"248.5\" r=\"1\" stroke=\"#6b0277\" stroke-width=\"1\" fill=\"#6b0277\"></circle><circle cx=\"119.29411764705883\" cy=\"328.5107375343937\" r=\"1\" stroke=\"#5e0f03\" stroke-width=\"1\" fill=\"#5e0f03\"></circle><circle cx=\"293.11764705882354\" cy=\"485.7726662640091\" r=\"1\" stroke=\"#5e0f03\" stroke-width=\"1\" fill=\"#5e0f03\"></circle><circle cx=\"514\" cy=\"488.5\" r=\"1\" stroke=\"#5e0f03\" stroke-width=\"1\" fill=\"#5e0f03\"></circle></g></svg>", rootPath + jxImg);
    }

    /**
     * 将svg字符串转换为png
     *
     * @param svgCode     svg代码
     * @param pngFilePath 保存的路径
     */
    public static boolean convertToPng(String svgCode, String pngFilePath) {
        if (svgCode == null || svgCode.length() == 0) {
            return false;
        }
        //获取文件夹路径，不存在先创建文件夹
        int i = pngFilePath.lastIndexOf("/");
        String parentPath = StringUtils.substring(pngFilePath, 0, i + 1);
        File parentFile = new File(parentPath);
        if(!parentFile.exists()) {
            parentFile.mkdirs();
        }
        File file = new File(pngFilePath);
        FileOutputStream outputStream = null;
        boolean result = false;
        try {
            if(file.canWrite()) {
                file.createNewFile();
            }else {
                file.setWritable(true);
                file.createNewFile();
            }
            outputStream = new FileOutputStream(file);
            result = convertToPng(svgCode, outputStream);
        } catch (Exception e) {
            e.printStackTrace();
            result = false;
        } finally {
            if (outputStream != null) {
                try {
                    outputStream.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return result;
    }

    /**
     * 将svgCode转换成png文件，直接输出到流中
     *
     * @param svgCode      svg代码
     * @param outputStream 输出流
     */
    public static boolean convertToPng(String svgCode, OutputStream outputStream) {
        try {
            byte[] bytes = svgCode.getBytes("utf-8");
            PNGTranscoder t = new PNGTranscoder();
            TranscoderInput input = new TranscoderInput(new ByteArrayInputStream(bytes));
            TranscoderOutput output = new TranscoderOutput(outputStream);
            t.transcode(input, output);
            outputStream.flush();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

}
